#
faces = [{'faceId': 'c9a301fc-da2c-4866-924c-d27e3a41aea3',
  'faceRectangle': {'top': 406, 'left': 442, 'width': 410, 'height': 410},
  'faceAttributes': {'smile': 0.725,
  'gender': 'female',
  'age': 21.0,
  'glasses': 'NoGlasses',
  'hair': {'bald': 0.04,
  'invisible': False,
  'hairColor': [{'color': 'blond', 'confidence': 0.81},
  {'color': 'gray', 'confidence': 0.78},
  {'color': 'other', 'confidence': 0.71},
  {'color': 'black', 'confidence': 0.29},
  {'color': 'red', 'confidence': 0.25},
  {'color': 'brown', 'confidence': 0.16},
  {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': '7bc56907-cdfe-47b7-afff-488ac7305af3',
  'faceRectangle': {'top': 127, 'left': 217, 'width': 253, 'height': 253},
  'faceAttributes': {'smile': 0.0,
  'headPose': {'pitch': -11.9, 'roll': -3.7, 'yaw': -16.4},
  'gender': 'female',
  'age': 19.0,
  'glasses': 'NoGlasses',
  'hair': {'bald': 0.03,
  'invisible': False,
  'hairColor': [{'color': 'brown', 'confidence': 1.0},
  {'color': 'blond', 'confidence': 0.58},
  {'color': 'red', 'confidence': 0.4},
  {'color': 'black', 'confidence': 0.37},
  {'color': 'gray', 'confidence': 0.09},
  {'color': 'other', 'confidence': 0.06},
  {'color': 'white', 'confidence': 0.0}]}}},
 {'faceId': 'cbb83b49-7744-4233-bf3d-3d650fe2522c',
  'faceRectangle': {'top': 41, 'left': 676, 'width': 52, 'height': 52},
  'faceAttributes': {'smile': 1.0,
  'gender': 'male',
  'age': 25.0,
  'glasses': 'ReadingGlasses',
  'hair': {'bald': 0.06,
  'invisible': False,
  'hairColor': [{'color': 'black', 'confidence': 0.98},
  {'color': 'brown', 'confidence': 0.96},
  {'color': 'other', 'confidence': 0.22},
  {'color': 'gray', 'confidence': 0.21},
  {'color': 'red', 'confidence': 0.09},
  {'color': 'blond', 'confidence': 0.08},
  {'color': 'white', 'confidence': 0.0}]}}}
        ]
# 创建字典
glasses = {}
smile = {}
hairColor = {}
age = {}
gender = {}
# 将人脸信息加入字典
count = 0
while count < len(faces):
    glasses["Person{}".format(count + 1)] = faces[count]['faceAttributes']['glasses']
    smile["Person{}".format(count + 1)] = faces[count]['faceAttributes']['smile']
    hairColor["Person{}".format(count + 1)] = faces[count]['faceAttributes']['hair']['hairColor'][0]['color']
    age["Person{}".format(count + 1)] = faces[count]['faceAttributes']['age']
    gender["Person{}".format(count + 1)] = faces[count]['faceAttributes']['gender']
    count += 1

# 打印
print("眼镜：", glasses)
print("微笑指数：", smile)
print("头发颜色：", hairColor)
print("年龄：", age)
print("性别：", gender)



